package com.xuecheng.content.api;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.xuecheng.content.model.po.CourseTeacher;
import com.xuecheng.content.model.po.Teachplan;
import com.xuecheng.content.service.CourseTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: 我在人间讲故事
 * @Version: 1.0
 * @since: 2023/6/6
 * @description: 教师信息相关接口
 */
@Api(value = "教师信息相关接口", tags = "教师信息相关接口")
@RestController
public class CourseTeacherController {

    @Autowired
    CourseTeacherService courseTeacherService;


    /**
     * 根据课程id查询所有教师信息
     * @param courseId
     * @return
     */
    @ApiOperation(value = "根据课程id查询所有教师信息")
    @GetMapping("/courseTeacher/list/{courseId}")
    public List<CourseTeacher> getCourseTeacherList(@PathVariable Long courseId) {
        List<CourseTeacher> courseTeacherList = courseTeacherService.getCourseTeacherList(courseId);
        return courseTeacherList;
    }

    @ApiOperation(value = "添加修改教师信息接口")
    @PostMapping("/courseTeacher")
    public List<CourseTeacher> saveCourseTeacher(@RequestBody CourseTeacher courseTeacher){
        List<CourseTeacher> courseTeachers = courseTeacherService.saveCourseTeacher(courseTeacher);
        return courseTeachers;

    }

    @ApiOperation(value = "删除教师信息")
    @DeleteMapping("/courseTeacher/course/{courseId}/{teacherId}")
    public void deleteCourseTeacher(@PathVariable("courseId") Long courseId
            ,@PathVariable("teacherId") Long teacherId){
        courseTeacherService.deleteCourseTeacher(courseId,teacherId);
    }

}
